<template>
  <svg class="icon-svg" aria-hidden="true" :style="size">
    <use  :href="symbolId" :fill="color" />
  </svg>
</template>

<script>
import { computed } from "vue";
export default {
  name: "SvgIcon",
  components: {},
  props: {
    prefix: {
      type: String,
      default: "icon",
    },
    name: {
      type: String,
      required: true,
    },
    color: {
      type: String,
      default: "green",
    },
    width: {
      type: String,
      default: "1em",
    },
    height: {
      type: String,
      default: "1em",
    },
  },
  setup(props) {
    const symbolId = computed(() => `#${props.prefix}-${props.name}`);
    const size = computed(() => `width:${props.width};height:${props.height};`);
    return { symbolId, size };
  },
};
</script>
<style scoped>
.icon-svg {
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>